package com.fly.controller;

import com.fly.common.utils.SortMethod;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.*;

/**
 * Created by SWan on 2017/4/6.
 */
@Controller
@RequestMapping("/")
public class Cp1Controller {

    @RequestMapping(value = "/cp1")
    public ModelAndView cp1(){
        ModelAndView mv = new ModelAndView("study/cp1");
        mv.addObject("intVar", 100);
        mv.addObject("longVar", 100000);
        mv.addObject("stringVar", "我是字符串");
        mv.addObject("doubleVar", 3.14);
        mv.addObject("booleanVar", true);
        mv.addObject("dateVar", new Date());
        mv.addObject("nullVar", null);
        mv.addObject("htmlVar","<font color='red'>我只想早点下班</font>");

        List<String> list = new ArrayList<String>();
        list.add("C语言");
        list.add("Java语言");
        list.add("C++");
        mv.addObject("myList",list);

        Map<String,String> map = new HashMap<String, String>();
        map.put("java", "你好Java");
        map.put("python", "你好python");
        map.put("php", "你好php");
        mv.addObject("myMap", map);

        mv.addObject("sort_int", new SortMethod());
        return mv;
    }
}
